/**
 * Copyright (c) 2021 SQLines
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <QVBoxLayout>
#include <QPixmap>
#include <QLabel>

#include "aboutwidget.hpp"

using namespace ui;

AboutWidget::AboutWidget(QWidget* parent) noexcept
 :  QDialog(parent)
{
    paint();
}

void AboutWidget::paint() noexcept
{
    setWindowTitle("About SQLines Studio");
    setFixedSize(250, 350);
    
    auto layout = new QVBoxLayout(this);

    auto logoLabel = new QLabel;
    logoLabel->setPixmap(QPixmap(":/logo.png"));
    logoLabel->setAlignment(Qt::AlignCenter);

    auto appNameLabel = new QLabel;
    appNameLabel->setText("<b>SQLines Studio</b>\n");
    appNameLabel->setAlignment(Qt::AlignCenter);
    
    auto infoLabel = new QLabel;
    infoLabel->setText("Version: 3.0\n© 2021 SQLines");
    infoLabel->setAlignment(Qt::AlignCenter);
    
    auto copyrightLabel = new QLabel;
    copyrightLabel->setText("All rights reserved.");
    copyrightLabel->setAlignment(Qt::AlignCenter);
    
    layout->addWidget(logoLabel);
    layout->addWidget(appNameLabel);
    layout->addWidget(infoLabel);
    layout->addWidget(copyrightLabel);
    layout->setAlignment(Qt::AlignCenter);
}
